e
#Title[uVollendet Regenbogenv]
#Text[I
uVollendet Regenbogenv]
#BackGround[User]
#BGM[.\..\bgm\bgm.wav]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
	
	////////////////////////////////////////////////////////////////////////
	//                                                          //
	//   way炵                                                  //
	//   ōx𑁂                                               //
	//   ˊԊuAړԊu𑁂                                     //
	//   `Ԃ̓WJpxύX                                     //
	////////////////////////////////////////////////////////////////////////
	
	@Initialize{
		InitializeData();
		
		LoadUserShotData(shot_ryoyan);
		
		SetLife(1000);
		SetMovePosition03(GetCenterX(),120,10,8);
		SetDamageRate(22,16);
		SetInvincibility(240);
		SetCollisionEx(32,16);
		SetEnemyMarker(true);
		
		TMain();
	}
	
	@MainLoop{
		yield;
	}
	
	@DrawLoop{
		DrawBoss(imgBoss);
	}
	
	@Finalize{
		FinalizeData();
	}
	
	task TMain(){
		wait(60);
		
		DeclareSpell();
		
		Atack();
		Move();
	}
	
	function DeclareSpell(){
		SetTimer(90);
		CutIn(YOUMU,"uVollendet Regenbogenv",NULL,0,0,0,0);
		SetScore(1000000);
		wait(180);
	}
	
	task Atack(){
		let color = [ _RED01(), _ORANGE01(), _YELLOW01(), _GREEN01(), _AQUA01(), _BLUE01(), _PURPLE01() ];
		
		let way = 70;
		let tm = 45;
		let tm2 = 0;
		let count = 0;
		
		loop{
			CreateLaserB(0,100,15,_WHITE21(),0);
			SetShotKillTime(0,20 + way);
			SetLaserDataB(0,0,0,25,0,tm,0,tm,0);
			SetLaserDataB(0,20,0,NULL,0,NULL,360 / way,NULL,360 / way);
			
			ascent(i in 0..way * 7){
				alternative(count % 4)
					case(0){
						tm2 = i % way *  360 / way + tm;
					}
					case(1){
						tm2 = i % way * -360 / way + trunc(i / way) * (1080 + 190) / 7;
					}
					case(2){
						tm2 = i % way *  360 / way - 180 + i % (way / 3) * 360 / way;
					}
					case(3){
						tm2 = i % way *  360 / way + tm + way * (i % 2 * 2 - 1);
					}
					others{
						tm2 = 0;
					}
				
				CreateShotA(1,0,0,5);
				SetShotDataA(1,0,0,0,0,0,0,color[trunc(i / way)]);
				SetShotDataA(1,140 - i % way + trunc(i / way) * 20,0,tm2,0,0.05,2.6,color[trunc(i / way)]);
				AddShot(20 + i % way,0,1,100 - trunc(i / way) * 15);
			}
			
			FireShot(0);
			
			count += 1;
			
			wait(240);
		}
	}
	
	task Move(){
		let tm = 0;
		
		wait(200);
		
		loop{
			tm = GetPlayerX() + rand(-30,30);
			
			if(tm >= GetClipMaxX() - 120){
				tm = GetClipMaxX() - 100;
			}
			if(tm <= GetClipMinX() + 120){
				tm = GetClipMinX() + 100;
			}
			
			SetMovePosition03(tm,rand(120,150),30,5);
			
			wait(240);
		}
	}
	
	#include_function ".\..\functions\initialize.txt"
	#include_function ".\..\functions\color_set.txt"
	#include_function ".\..\functions\function.txt"
}
